#ifndef MAP_H
#define MAP_H

#include <QVector>
#include <QString>
#include <QPoint>
#include <QRect>
#include <QPixmap>
#include "minion.h"

struct MiniMinion
{
    QString Filename;
    QPoint SpawnPoint;
    QVector<QPoint> Route; // path through which miniminion will travel
};

struct TeamSettings
{
    double DefaultOrientation = 0.0;
    QVector<QPoint> RespawnPoints;
    QVector<MiniMinion> MiniSpawnPoints;
};

class Map
{
    QVector<TeamSettings> Teams;
    QVector<QRect> Obstacles;
    QPixmap *Background;

    int SpawnPeriod; // number of seconds between consecutive spawns of miniminions
    int SpawnTimeLeft; // number of seconds before next wave of miniminionss is spawned

    inline void ProcessObstacle(const QString &value);
    inline void ProcessRespawn(const QString &value);
    inline void ProcessMiniminion(const QString &value);
    inline void ProcessTower(const QString &value);
    inline void ProcessDefaultOrientation(const QString &value);
    inline void ProcessMinionSpawn(const QString &value);
    inline void ProcessMinionRoute(const QString &value);

public:
    Map(const QString &Filename);
    void Tick();
    QPixmap *GetBackground();
    double GetTeamDefaultOrientation(unsigned int team);

    friend class Engine;
};

#endif // MAP_H
